rollout Select_Extension "Select_Extension beta1.1" width:184 height:256
(
	pickbutton btn1 "Select Instace Object" pos:[16,24] width:152 height:16
	
	
	pickbutton btn2 "Select Similar Modifier" pos:[16,48] width:152 height:16
	pickbutton btn3 "Select Similar Class" pos:[16,72] width:152 height:16
	label CopyLight "Huazai1984" pos:[88,168] width:72 height:16
	GroupBox grp1 "Tool" pos:[8,8] width:168 height:136
	GroupBox grp2 "CopyLight" pos:[8,152] width:168 height:88
	label lbl2 "Author:" pos:[16,168] width:56 height:16
	label lbl3 "Data:" pos:[16,184] width:56 height:16
	label lbl4 "2007-6-2" pos:[88,184] width:72 height:16
	label lbl5 "Version:" pos:[16,200] width:56 height:16
	label lbl6 "Beta 1.1" pos:[88,200] width:72 height:16
	label lbl7 "Oicq:" pos:[16,216] width:56 height:16
	label lbl8 "65235268" pos:[88,216] width:72 height:16
	button btn4 "Select Repeat Object" pos:[16,96] width:152 height:16
	button btn5 "Select Repeat" pos:[16,120] width:96 height:16
	spinner spn3 "" pos:[120,120] width:48 height:16 enabled:true range:[0,100,10] type:#integer
	
	
	on btn1 picked obj do
	(
		if obj != undefined do
		(			
			theSource = Obj
			instanceMgr.GetInstances theSource &theInstance
			select theInstance
		)
	)
	on btn1 rightClick do
	(
		if selection.count == 1 do
		(
			theSource = selection[1]
			instanceMgr.GetInstances theSource &theInstance
			select theInstance
		)
	)
	on btn2 picked obj do
	(
		if obj != undefined do
		(
		theSource = Obj
		
		if theSource.modifiers[1] != undefined do
		(
			select ( for g in geometry where isProperty g ( (classof theSource.modifiers[1]) as string ) collect g )
		)
		)
		
	)
	on btn2 rightClick do
	(
		if selection.count == 1 do
		(
		theSource = selection[1]
		
		if theSource.modifiers[1] != undefined do
		(
			select ( for g in geometry where isProperty g ( (classof theSource.modifiers[1]) as string ) collect g )
		)
		)
	)
	on btn3 picked obj do
	(
		if obj != undefined do
		(
			theSource = Obj
			select ( for g in geometry where classof g == classof theSource collect g )		 
		)
		
	)
	on btn3 rightClick do
	(
		if selection.count == 1 do
		(
			theSource = selection[1]
			select ( for g in geometry where classof g == classof theSource collect g )		 
		)
	)
	on btn4 pressed do
	(
	theArray = for o in geometry collect
	(
		CameraTm = inverse(getViewTM())
		theRay = Ray CameraTm.pos -(CameraTm.pos - o.pos)
		
		( intersectRay o theRay ) as string
	)
	
	intersect_obj = for a in 1 to theArray.count where ( for i in theArray where theArray[a] == i collect geometry[a] ).count == 2 collect geometry[a]
	
	select intersect_obj
	
	)
	on btn5 pressed do
	(
	
	try(
	
	fn getArray theArray = 
	(
	for o in 1 to theArray.count do
	(
		for i in 1 to theArray.count do
		(
			if i != o do
			(
				if ( theArray[i] as string == theArray[o] as string ) do
				(
					deleteItem theArray i
				)
			)
		)
	)
	
	return theArray
	)--getArray End
	
	fn getObjArray a_array b_array c_array = 
	(
		
		v_Temp = #()
		for i in 1 to b_array.count do
		(
			if (for b in b_array where b as string == b_array[i] as string collect b).count == 1 do
			(
				append v_Temp a_array[i]
			)
		)
		
		for i in 1 to v_Temp.count do
		(
			deleteItem a_array (findItem a_array v_Temp[i])
		)
		
		d_Temp = #()
		for i in 1 to c_array.count do
		(
			if ( for c in c_array where c as string == c_array[i] as string collect c ).count == 1 do
			(
				append d_Temp a_array[i]
			)
		)
		
		for i in 1 to d_Temp.count do
		(
		deleteItem a_array (findItem a_array d_Temp[i])
		)
		
		return a_Array
		
	)--getObjArray End
	
	
	d_a_n = #()
	
	
	for o in geometry do
	(
		if ( for i in geometry where distance o.pos i.pos < 10 collect i.name ).count > 1 do
		(
		append d_a_n ( for i in geometry where distance o.pos i.pos < spn3.value collect i)
	
		)
	)
	
	
	d_a_n = getArray d_a_n
	d_a_v = for i in 1 to d_a_n.count collect 
	(
		for i in d_a_n[i] collect 
		(
			i.mesh.numVerts
		)
	)
	
	d_a_d = for i in 1 to d_a_n.count collect 
	(
		for i in d_a_n[i] collect 
		(
			i.dir
		)
	)
	
	final_array = #()
	
	for i in 1 to d_a_n.count do
	(
		join final_array (getObjArray d_a_n[i] d_a_v[i] d_a_d[i])
	)
	
	select final_Array
	
	)catch()
	
	)
)

CreateDialog Select_Extension

